(defun name-pow (s)
  (reduce #'+
	  (loop for char across s collect
		(1+ (- (char-code char) (char-code #\A))))))

(defun get-names (file-name)
	(with-open-file (stream file-name)
		(sort (read stream) #'string<)))
	
(print (loop for i in (get-names "lisp/names.txt")
	     for j = 1 then (1+ j)
	     sum (* j (name-pow i))))
